package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                        import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.CustContactsRelativeMapper;
import com.ruoyi.bizsys.domain.CustContactsRelative;
import com.ruoyi.bizsys.service.ICustContactsRelativeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 用户通讯录关联Service业务层处理
 *
 * @author african-loan
 * @date 2021-12-10
 */
@Service
public class CustContactsRelativeServiceImpl extends ServiceImpl<CustContactsRelativeMapper,CustContactsRelative> implements ICustContactsRelativeService
{

    /**
     * 查询用户通讯录关联
     *
     * @param id 用户通讯录关联ID
     * @return 用户通讯录关联
     */
    @Override
    public CustContactsRelative selectCustContactsRelativeById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询用户通讯录关联列表
     *
     * @param custContactsRelative 用户通讯录关联
     * @return 用户通讯录关联
     */
    @Override
    public List<CustContactsRelative> selectCustContactsRelativeList(CustContactsRelative custContactsRelative) {
        return this.list(new QueryWrapper<>(custContactsRelative).last("order by id desc"));
    }

    /**
     * 新增用户通讯录关联
     *
     * @param custContactsRelative 用户通讯录关联
     * @return 结果
     */
            @Override
    public int insertCustContactsRelative(CustContactsRelative custContactsRelative) {
                                                                                                custContactsRelative.setCreateTime(DateUtils.getNowDate());
                            return baseMapper.insert(custContactsRelative);
    }

    /**
     * 修改用户通讯录关联
     *
     * @param custContactsRelative 用户通讯录关联
     * @return 结果
     */
            @Override
    public int updateCustContactsRelative(CustContactsRelative custContactsRelative) {
                                                                                                return baseMapper.updateById(custContactsRelative);
    }

    /**
     * 批量删除用户通讯录关联
     *
     * @param ids 需要删除的用户通讯录关联ID
     * @return 结果
     */
            @Override
    public int deleteCustContactsRelativeByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除用户通讯录关联信息
     *
     * @param id 用户通讯录关联ID
     * @return 结果
     */
    @Override
    public int deleteCustContactsRelativeById(Long id) {
        return baseMapper.deleteById(id);
    }

}
